package org.levi.demo.controller;

import org.levi.demo.org.levi.demo.service.AutoDeliverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/autoDeliver")
public class DeliverController {

    @Autowired
    private AutoDeliverService autoDeliverService;

    @GetMapping("resume/{userId}")
    public String autoDeliverResume(@PathVariable long userId){

        if(autoDeliverService.autoDeliverResume(userId)){
            return "success!";
        }
        return "deliver failed!";
    }

    @GetMapping("resume2/{userId}")
    public String autoDeliverResumeTimeout(@PathVariable long userId){

        if(autoDeliverService.autoDeliverResumeTimeout(userId,2000)){
            return "success!";
        }
        return "deliver failed!";
    }
}
